package com.tbitsglobal.client;

import com.google.gwt.core.client.EntryPoint;
import com.google.gwt.user.client.ui.DockPanel;
import com.google.gwt.user.client.ui.HorizontalPanel;
import com.google.gwt.user.client.ui.Panel;
import com.google.gwt.user.client.ui.RootPanel;
import com.google.gwt.user.client.ui.SimplePanel;
import com.google.gwt.user.client.ui.VerticalPanel;

/**
 * Entry point classes define <code>onModuleLoad()</code>.
 */
public class Talk implements EntryPoint {

	private static Talk instance;
	public static Talk get()
	{
		return instance;
	}
	
	VerticalPanel contentPanel;
	LoginPage loginPage;
	ConversationPage convPage;
	ChatHome chatHome;
	public void onModuleLoad() {
		// TODO Auto-generated method stub
		instance = this;
		contentPanel = new VerticalPanel();
		HorizontalPanel statusBar = new HorizontalPanel();
		
		DockPanel outer;
		outer = new DockPanel();
		outer.add(statusBar, DockPanel.SOUTH);
		outer.add(contentPanel, DockPanel.CENTER);
		
		loginPage = new LoginPage();
		contentPanel.add(loginPage);
		convPage = new ConversationPage();
		
		chatHome = new ChatHome();
		RootPanel.get().add(contentPanel);
		
	}
	public void startChat(String user)
	{
		contentPanel.clear();
		contentPanel.add(convPage);
	}
	
	public void goHome()
	{
		contentPanel.clear();
		contentPanel.add(chatHome);
	}
	
	public void logout()
	{
		contentPanel.clear();
		contentPanel.add(loginPage);
	}
}